<!-- 左侧面板 -->
<template>
  <ModelTile class="zdly" title="重点领域">
    <div class="tab">
      <div class="table-wrapper">
        <div class="table-header">
          <ul>
            <li class="table-row">
              <span
                v-for="(item, index) of tableColumn"
                :key="index"
                :class="{ column: true, 'text-right': item.label === '实际完成投资' }"
                >{{ item.label }}</span
              >
            </li>
          </ul>
        </div>
        <div class="table-content">
          <ul>
            <li
              v-for="(row, index) in tableData"
              :key="index"
              :class="{ 'table-row': true, 'even-row': index % 2 === 1 }"
            >
              <span class="column">{{ row.category }}</span>
              <span class="column text-right">{{ row.invest }}</span>
              <span class="column">{{ row.compare }}</span>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </ModelTile>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import ModelTile from '@/components/modleTitle/index.vue'
const tableColumn = ref([
  { label: '领域类别', prop: 'category' },
  { label: '实际完成投资', prop: 'invest' },
  { label: '同比', prop: 'compare' }
])
const tableData = ref([
  { category: '制造业', invest: '10000亿', compare: '10%' },
  { category: '工业技改', invest: '4亿', compare: '10%' },
  { category: '汽车', invest: '32亿', compare: '10%' },
  { category: '电子', invest: '32亿', compare: '10%' },
  { category: '石化', invest: '1000亿', compare: '10%' },
  { category: '手工业', invest: '2亿', compare: '10%' },
  { category: '石化', invest: '1000亿', compare: '10%' },
  { category: '手工业', invest: '2亿', compare: '10%' },
  { category: '石化', invest: '1000亿', compare: '10%' },
  { category: '手工业', invest: '2亿', compare: '10%' }
])
</script>
<style lang="scss" scoped>
.zdly {
  // margin: -32vh * $Bh -32vw * $Bw;
}
.table-wrapper {
  width: 100%;
  height: 480vh * $Bh; /* 设置表格容器的高度 */
  overflow: scroll; /* 隐藏溢出内容 */
  position: relative;
}

.table-header {
  position: sticky;
  top: 0; /* 表头固定在顶部 */
  background-color: #213b76;
  height: 80vh * $Bh; /* 设置表头的高度 */
  // line-height: 80vh * $Bh; /* 设置行高，以便内容垂直居中 */
  border-bottom: 2px solid #5492e4;
}

.table-content {
  overflow-y: scroll; /* 表格内容超出高度时实现滚动 */
}

ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.table-row {
  display: flex;
  // border-bottom: 1px solid #ddd;
  height: 80vh * $Bh; /* 设置行的高度 */
  .column {
    // line-height: 80vh * $Bh; /* 设置行的高度 */
  }
}
.even-row {
  background: #213b76;
}

.column {
  flex: 1;
  padding: 8px;
  text-align: left;
}
.text-right {
  text-align: right;
}
</style>
